package com.cino.service.impl;

import com.cino.domain.Teacher;
import com.cino.mapper.TeacherMapper;
import com.cino.service.ITeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional(readOnly = true,propagation = Propagation.SUPPORTS)
public class TeacherServiceImpl implements ITeacherService {

    @Autowired
    private TeacherMapper teacherMapper;


    @Override
    public  List<Teacher> getAll() {
        return   teacherMapper.getAll();
    }

    @Override
    @Transactional
    public void save(Teacher teacher) {
        teacherMapper.save(teacher);
    }

    @Override
    @Transactional
    public void update(Teacher teacher) {
        teacherMapper.update(teacher);
    }

    @Override
    @Transactional
    public void delete(Long id) {
        teacherMapper.delete(id);
    }

    @Override
    public Teacher getOne(Long id) {
        return   teacherMapper.getOne(id);
    }
}
